import 'package:flutter/material.dart';
import 'package:get/get.dart';

class ObxPage extends StatelessWidget {
  ObxPage({Key key}) : super(key: key);
  final count = 0.obs;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('obx'),
      ),
      body: Center(
        child: Column(
          children: [
            Obx(() => Text('count1 -> ' + count.toString())),
            Obx(() => Text('count2 -> ' + count.toString())),
            Divider(),
            ElevatedButton(
                onPressed: () {
                  count.value++;
                },
                child: Text('add'))
          ],
        ),
      ),
    );
  }
}
